package com.ray.activiti.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import com.ray.activiti.service.ExtendActFlowbusService;
import com.ray.activiti.table.entity.ExtendActFlowbus;
import com.ray.activiti.table.mapper.ExtendActFlowbusMapper;


/**
 * 
 * @Auther ray  qray686898@163.com
 * @Date 2017/12/28
 * @代码参考或来自  https://github.com/huangxianyuan/hxyFrame
 *
 */
@Service
public class ExtendActFlowbusServiceImpl implements ExtendActFlowbusService {
	@Autowired
	private ExtendActFlowbusMapper extendActFlowbusMapper;
	
	@Transactional(propagation=Propagation.NOT_SUPPORTED)
	public ExtendActFlowbus queryObject(String id){
		return extendActFlowbusMapper.queryObject(id);
	}

    @Transactional(propagation=Propagation.REQUIRED,rollbackFor=Exception.class) 
	public void save(ExtendActFlowbus extendActFlowbus){
		extendActFlowbusMapper.save(extendActFlowbus);
	}
	
    @Transactional(propagation=Propagation.REQUIRED,rollbackFor=Exception.class) 
	public void update(ExtendActFlowbus extendActFlowbus){
		extendActFlowbusMapper.update(extendActFlowbus);
	}
    @Transactional(propagation=Propagation.REQUIRED,rollbackFor=Exception.class) 
	public void delete(String id){
		extendActFlowbusMapper.delete(id);
	}

    @Transactional(propagation=Propagation.REQUIRED,rollbackFor=Exception.class) 
	public int updateByBusId(ExtendActFlowbus extendActFlowbusEntity) {
		return extendActFlowbusMapper.updateByBusId(extendActFlowbusEntity);
	}

	@Transactional(propagation=Propagation.NOT_SUPPORTED)
	public ExtendActFlowbus queryByBusIdInsId(String instanceId, String busId) {
		Map<String,Object> params = new HashMap<String,Object>();
		params.put("instanceId",instanceId);
		params.put("busId",busId);
		return extendActFlowbusMapper.queryByBusIdInsId(params);
	}
}
